﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once
#include "GapViewAndPositionReference.h"
#include "RuntimeId.h"
#include <map>

namespace gcmp
{
    class IDocument;
}

namespace gap
{
    enum class DocumentStates
    {
        Unknow,     // 未支持类型
        Native,     // 本地文件文档
        Cloud,      // 协同工作单元文档
    };

    class GAP_VIEW_AND_POSITION_REFERENCE_EXPORT DocumentStatesManager
    {
    public:
        static DocumentStatesManager* Get();

        std::wstring GetApplicationType() const { return m_applicationType; };
        bool SetApplicationType(const std::wstring& applicationType) { m_applicationType = applicationType; return true; };

        // 设置文档的状态
        void SetDocumentState(const gcmp::IDocument* pDocument, DocumentStates state);
        DocumentStates GetDocumentState(const gcmp::IDocument* pDocument) const;
        void ClearDocumentState(const gcmp::IDocument* pDocument);

    private:
        DocumentStatesManager();
  
    private:
        std::wstring m_applicationType;
        std::map<gcmp::RuntimeId, DocumentStates> m_documentStates;
    };
}

